package com.example.spring.service;

import com.example.spring.entity.Warehouse;
import com.example.spring.mapper.WarehouseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WarehouseService {
    @Autowired
    private WarehouseMapper warehouseMapper;

    public int save(Warehouse warehouse){
        if(warehouse.getWhid() == null) { //无id新增id
            return warehouseMapper.insert_data(warehouse);
        }
        else {//否则更新
            return warehouseMapper.update(warehouse);
        }
    }
}
